-
-
Couldn't load subscription status.
- Fork 5
Support packaging of project translation files #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice functionality, +1 for the tests.
Code looks good. A few tiny comments on readability. Feel free to merge.
Do you consider this "QFieldCloud sensitive files", such as the plugins? Shall we add them here:
https://github.com/opengisch/QFieldCloud/blob/master/docker-app/qfieldcloud/filestorage/utils.py#L69
|
@suricactus , review addressed thanks. Regarding "sensitive files", I wouldn't flag the translations as being sensitive. If you have a strong feeling about it, we can add it into the above-mentioned function. |
|
|
||
| # Check for project translations asset | ||
| for translation_file in glob( | ||
| f"{str(self.original_filename)[:-4]}_[A-Za-z][A-Za-z].qm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use the same pattern, so here also make [A-Za-z]{2}?
| ).resolve() | ||
| destination_file.parent.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| # Project plugins and translation files require for their file name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you see this portion of the code somehow moved to a function? I think it is a good isolated block that can be moved, the _convert function is already convoluted enough to be read.
This unlocks translated projects on QFieldCloud by insuring that {project name}_{2-letter language code}.qm files are copied into the packaged project directory.
The PR also insures that sidecar translations and project plugin files properly adopt the exported project name (i.e. myproject.qgs -> myproject_cloud.qgs means the project plugin file will become myproject_cloud.qml and translation files would be myproject_de.qm, myproject_fr.qm, etc.).
Test coverage included.